package cn.shopping.core.mapper;

import cn.shopping.common.mapper.CommonMapper;
import cn.shopping.core.dbo.GoodsFileDO;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.util.CollectionUtils;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;



/**
 * 代码自动生成，请不要修改，切记！！！
 */
@Mapper
public interface GoodsFileMapper extends CommonMapper<GoodsFileDO,Long> {

        public List<GoodsFileDO> listByClfGoodsId(@Param("clfGoodsId") Long clfGoodsId,@Param("fieldNames") String[] fieldNames);

        @MapKey("id")
        public Map<Long,GoodsFileDO> mapByClfGoodsId(@Param("clfGoodsId") Long clfGoodsId,@Param("fieldNames") String[] fieldNames);

        public Integer countByClfGoodsId(@Param("clfGoodsId") Long clfGoodsId);

        public default GoodsFileDO singleResultByClfGoodsId(Long clfGoodsId,String[] fieldNames){
             List<GoodsFileDO> list=this.listByClfGoodsId(clfGoodsId,fieldNames);
             return CollectionUtils.isEmpty(list)?null:list.get(0);
        }

         public default <T> Map<T,List<GoodsFileDO>> groupingByClfGoodsId(Long clfGoodsId, Function<GoodsFileDO, T> mapper, String[] fieldNames){
             List<GoodsFileDO> list=this.listByClfGoodsId(clfGoodsId,fieldNames);
             if(CollectionUtils.isEmpty(list)){
                return new HashMap<>();
             }
             return list.stream().collect(Collectors.groupingBy(mapper));
         }

        public Integer updateNotNullFieldsByClfGoodsId(@Param("updateDO") GoodsFileDO updateDO, @Param("clfGoodsId") Long clfGoodsId);

        public Integer updateAllFieldsByClfGoodsId(@Param("updateDO") GoodsFileDO updateDO, @Param("clfGoodsId") Long clfGoodsId);

        public Integer deleteByClfGoodsId( @Param("clfGoodsId") Long clfGoodsId);




        public List<GoodsFileDO> listByInClfGoodsId(@Param("clfGoodsIdList") Collection<Long> clfGoodsIdList,@Param("fieldNames") String[] fieldNames);

        @MapKey("id")
        public Map<Long,GoodsFileDO> mapByInClfGoodsId(@Param("clfGoodsIdList") Collection<Long> clfGoodsIdList,@Param("fieldNames") String[] fieldNames);

        public Integer countByInClfGoodsId(@Param("clfGoodsIdList") Collection<Long> clfGoodsIdList);

        public default GoodsFileDO singleResultByInClfGoodsId(Collection<Long> clfGoodsIdList,String[] fieldNames){
             List<GoodsFileDO> list=this.listByInClfGoodsId(clfGoodsIdList,fieldNames);
             return CollectionUtils.isEmpty(list)?null:list.get(0);
        }

         public default <T> Map<T,List<GoodsFileDO>> groupingByInClfGoodsId(Collection<Long> clfGoodsIdList, Function<GoodsFileDO, T> mapper, String[] fieldNames){
             List<GoodsFileDO> list=this.listByInClfGoodsId(clfGoodsIdList,fieldNames);
             if(CollectionUtils.isEmpty(list)){
                return new HashMap<>();
             }
             return list.stream().collect(Collectors.groupingBy(mapper));
         }

        public Integer updateNotNullFieldsByInClfGoodsId(@Param("updateDO") GoodsFileDO updateDO, @Param("clfGoodsIdList") Collection<Long> clfGoodsIdList);

        public Integer updateAllFieldsByInClfGoodsId(@Param("updateDO") GoodsFileDO updateDO, @Param("clfGoodsIdList") Collection<Long> clfGoodsIdList);

        public Integer deleteByInClfGoodsId( @Param("clfGoodsIdList") Collection<Long> clfGoodsIdList);

        public List<GoodsFileDO> listByFileType(@Param("fileType") Integer fileType,@Param("fieldNames") String[] fieldNames);

        @MapKey("id")
        public Map<Long,GoodsFileDO> mapByFileType(@Param("fileType") Integer fileType,@Param("fieldNames") String[] fieldNames);

        public Integer countByFileType(@Param("fileType") Integer fileType);

        public default GoodsFileDO singleResultByFileType(Integer fileType,String[] fieldNames){
             List<GoodsFileDO> list=this.listByFileType(fileType,fieldNames);
             return CollectionUtils.isEmpty(list)?null:list.get(0);
        }

         public default <T> Map<T,List<GoodsFileDO>> groupingByFileType(Integer fileType, Function<GoodsFileDO, T> mapper, String[] fieldNames){
             List<GoodsFileDO> list=this.listByFileType(fileType,fieldNames);
             if(CollectionUtils.isEmpty(list)){
                return new HashMap<>();
             }
             return list.stream().collect(Collectors.groupingBy(mapper));
         }

        public Integer updateNotNullFieldsByFileType(@Param("updateDO") GoodsFileDO updateDO, @Param("fileType") Integer fileType);

        public Integer updateAllFieldsByFileType(@Param("updateDO") GoodsFileDO updateDO, @Param("fileType") Integer fileType);

        public Integer deleteByFileType( @Param("fileType") Integer fileType);




        public List<GoodsFileDO> listByInFileType(@Param("fileTypeList") Collection<Integer> fileTypeList,@Param("fieldNames") String[] fieldNames);

        @MapKey("id")
        public Map<Long,GoodsFileDO> mapByInFileType(@Param("fileTypeList") Collection<Integer> fileTypeList,@Param("fieldNames") String[] fieldNames);

        public Integer countByInFileType(@Param("fileTypeList") Collection<Integer> fileTypeList);

        public default GoodsFileDO singleResultByInFileType(Collection<Integer> fileTypeList,String[] fieldNames){
             List<GoodsFileDO> list=this.listByInFileType(fileTypeList,fieldNames);
             return CollectionUtils.isEmpty(list)?null:list.get(0);
        }

         public default <T> Map<T,List<GoodsFileDO>> groupingByInFileType(Collection<Integer> fileTypeList, Function<GoodsFileDO, T> mapper, String[] fieldNames){
             List<GoodsFileDO> list=this.listByInFileType(fileTypeList,fieldNames);
             if(CollectionUtils.isEmpty(list)){
                return new HashMap<>();
             }
             return list.stream().collect(Collectors.groupingBy(mapper));
         }

        public Integer updateNotNullFieldsByInFileType(@Param("updateDO") GoodsFileDO updateDO, @Param("fileTypeList") Collection<Integer> fileTypeList);

        public Integer updateAllFieldsByInFileType(@Param("updateDO") GoodsFileDO updateDO, @Param("fileTypeList") Collection<Integer> fileTypeList);

        public Integer deleteByInFileType( @Param("fileTypeList") Collection<Integer> fileTypeList);

        public List<GoodsFileDO> listByUploadId(@Param("uploadId") Long uploadId,@Param("fieldNames") String[] fieldNames);

        @MapKey("id")
        public Map<Long,GoodsFileDO> mapByUploadId(@Param("uploadId") Long uploadId,@Param("fieldNames") String[] fieldNames);

        public Integer countByUploadId(@Param("uploadId") Long uploadId);

        public default GoodsFileDO singleResultByUploadId(Long uploadId,String[] fieldNames){
             List<GoodsFileDO> list=this.listByUploadId(uploadId,fieldNames);
             return CollectionUtils.isEmpty(list)?null:list.get(0);
        }

         public default <T> Map<T,List<GoodsFileDO>> groupingByUploadId(Long uploadId, Function<GoodsFileDO, T> mapper, String[] fieldNames){
             List<GoodsFileDO> list=this.listByUploadId(uploadId,fieldNames);
             if(CollectionUtils.isEmpty(list)){
                return new HashMap<>();
             }
             return list.stream().collect(Collectors.groupingBy(mapper));
         }

        public Integer updateNotNullFieldsByUploadId(@Param("updateDO") GoodsFileDO updateDO, @Param("uploadId") Long uploadId);

        public Integer updateAllFieldsByUploadId(@Param("updateDO") GoodsFileDO updateDO, @Param("uploadId") Long uploadId);

        public Integer deleteByUploadId( @Param("uploadId") Long uploadId);




        public List<GoodsFileDO> listByInUploadId(@Param("uploadIdList") Collection<Long> uploadIdList,@Param("fieldNames") String[] fieldNames);

        @MapKey("id")
        public Map<Long,GoodsFileDO> mapByInUploadId(@Param("uploadIdList") Collection<Long> uploadIdList,@Param("fieldNames") String[] fieldNames);

        public Integer countByInUploadId(@Param("uploadIdList") Collection<Long> uploadIdList);

        public default GoodsFileDO singleResultByInUploadId(Collection<Long> uploadIdList,String[] fieldNames){
             List<GoodsFileDO> list=this.listByInUploadId(uploadIdList,fieldNames);
             return CollectionUtils.isEmpty(list)?null:list.get(0);
        }

         public default <T> Map<T,List<GoodsFileDO>> groupingByInUploadId(Collection<Long> uploadIdList, Function<GoodsFileDO, T> mapper, String[] fieldNames){
             List<GoodsFileDO> list=this.listByInUploadId(uploadIdList,fieldNames);
             if(CollectionUtils.isEmpty(list)){
                return new HashMap<>();
             }
             return list.stream().collect(Collectors.groupingBy(mapper));
         }

        public Integer updateNotNullFieldsByInUploadId(@Param("updateDO") GoodsFileDO updateDO, @Param("uploadIdList") Collection<Long> uploadIdList);

        public Integer updateAllFieldsByInUploadId(@Param("updateDO") GoodsFileDO updateDO, @Param("uploadIdList") Collection<Long> uploadIdList);

        public Integer deleteByInUploadId( @Param("uploadIdList") Collection<Long> uploadIdList);

        public List<GoodsFileDO> listBySeq(@Param("seq") Long seq,@Param("fieldNames") String[] fieldNames);

        @MapKey("id")
        public Map<Long,GoodsFileDO> mapBySeq(@Param("seq") Long seq,@Param("fieldNames") String[] fieldNames);

        public Integer countBySeq(@Param("seq") Long seq);

        public default GoodsFileDO singleResultBySeq(Long seq,String[] fieldNames){
             List<GoodsFileDO> list=this.listBySeq(seq,fieldNames);
             return CollectionUtils.isEmpty(list)?null:list.get(0);
        }

         public default <T> Map<T,List<GoodsFileDO>> groupingBySeq(Long seq, Function<GoodsFileDO, T> mapper, String[] fieldNames){
             List<GoodsFileDO> list=this.listBySeq(seq,fieldNames);
             if(CollectionUtils.isEmpty(list)){
                return new HashMap<>();
             }
             return list.stream().collect(Collectors.groupingBy(mapper));
         }

        public Integer updateNotNullFieldsBySeq(@Param("updateDO") GoodsFileDO updateDO, @Param("seq") Long seq);

        public Integer updateAllFieldsBySeq(@Param("updateDO") GoodsFileDO updateDO, @Param("seq") Long seq);

        public Integer deleteBySeq( @Param("seq") Long seq);




        public List<GoodsFileDO> listByInSeq(@Param("seqList") Collection<Long> seqList,@Param("fieldNames") String[] fieldNames);

        @MapKey("id")
        public Map<Long,GoodsFileDO> mapByInSeq(@Param("seqList") Collection<Long> seqList,@Param("fieldNames") String[] fieldNames);

        public Integer countByInSeq(@Param("seqList") Collection<Long> seqList);

        public default GoodsFileDO singleResultByInSeq(Collection<Long> seqList,String[] fieldNames){
             List<GoodsFileDO> list=this.listByInSeq(seqList,fieldNames);
             return CollectionUtils.isEmpty(list)?null:list.get(0);
        }

         public default <T> Map<T,List<GoodsFileDO>> groupingByInSeq(Collection<Long> seqList, Function<GoodsFileDO, T> mapper, String[] fieldNames){
             List<GoodsFileDO> list=this.listByInSeq(seqList,fieldNames);
             if(CollectionUtils.isEmpty(list)){
                return new HashMap<>();
             }
             return list.stream().collect(Collectors.groupingBy(mapper));
         }

        public Integer updateNotNullFieldsByInSeq(@Param("updateDO") GoodsFileDO updateDO, @Param("seqList") Collection<Long> seqList);

        public Integer updateAllFieldsByInSeq(@Param("updateDO") GoodsFileDO updateDO, @Param("seqList") Collection<Long> seqList);

        public Integer deleteByInSeq( @Param("seqList") Collection<Long> seqList);


}
